# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test06
# Description:   设置步长
# Author:       ASUS
# Date:         2019/1/20
#-------------------------------------------------------------------------------


numbers=[1,2,3,4,5,6,7,8,9]
print(numbers[1:6:2])                        #结果：[2, 4, 6]
print(numbers[:7:2])                         #结果：[1, 3, 5, 7]
print(numbers[::2])                          #结果：[1, 3, 5, 7, 9]
print(numbers[3::2])                         #结果：[4, 6, 8]
print(numbers[8:2:-2])                       #结果：[9, 7, 5]
print(numbers[:3:-2])                        #结果：[9, 7, 5]
print(numbers[::-3])                         #结果：[9, 6, 3]
print(numbers[3::-2])                         #结果：[4, 2]
# print(numbers[1:6:0])                      报错，步长不能为零

